<?php

require "include/rss_manager.inc.php";
$meta['title'] = 'Master di Cucina';
$meta['link'] = Config::$site_name . '/';
$meta['type'] = '';
$meta['description'] = 'Master di cucina - Ricette e Articoli';
$meta['language'] = 'it';
$meta['image_title'] = 'Logo Master di Cucina';
$meta['image_url'] = Config::$site_name . '/';
$meta['image_link'] = Config::$site_name . '/uploads/MasterInCucina.png';
$meta['image_width'] = '238';
$meta['image_height'] = '104';
$meta['copyright'] ='www.masterdicucina.it';
$myRss = new Rss_Manager('rss.xml', $meta);
$nric = 4;
$nart = 6;
$nvin = 2;
$nvip = 15 - ($nric + $nart + $nvin);
$ricette = "SELECT `r`.`Titolo` AS `title`,concat(`p`.`nome`,' ',`p`.`cognome`) AS `author`,`i`.`uri` as `uri`,`Data` as `pubDate`, CONCAT('" . Config::$site_name . '/ricetta/' . "',`r`.`Titolo`,'/') as link, `descrizione` as `description` FROM ((`ricette` `r` join `immagine` `i`) join `professori` `p`)  WHERE (`r`.`immagine` = `i`.`id`) and (`r`.`autore` = `p`.`id`) ORDER BY pubDate DESC LIMIT 0, " . $nric;
$vini = "SELECT `v`.`Titolo` AS `title`,concat(`p`.`nome`,' ',`p`.`cognome`) AS `author`,`i`.`uri` as `uri`,`Data` as `pubDate`, CONCAT('" . Config::$site_name . '/vino/' . "',`v`.`Titolo`,'/') as link, `descrizione` as `description` FROM ((`vini` `v` join `immagine` `i`) join `professori` `p`)  WHERE (`v`.`immagine` = `i`.`id`) and (`v`.`autore` = `p`.`id`) ORDER BY pubDate DESC LIMIT 0, " . $nvin;
$articoli = "SELECT `n`.`Titolo` AS `title`,concat(`p`.`nome`,' ',`p`.`cognome`) AS `author`,`i`.`uri` as `uri`,`Data` as `pubDate`, CONCAT('" . Config::$site_name . '/articolo/' . "',`n`.`Titolo`,'/') as link, `descrizione` as `description` FROM ((`notizie` `n` join `immagine` `i`) join `professori` `p`)  WHERE (`n`.`immagine` = `i`.`id`) and (`n`.`autore` = `p`.`id`) ORDER BY pubDate DESC LIMIT 0, " . $nart;
$vip = "SELECT `v`.`Titolo` AS `title`,concat(`p`.`nome`,' ',`p`.`cognome`) AS `author`,`i`.`uri` as `uri`,`Data` as `pubDate`, CONCAT('" . Config::$site_name . '/vip/' . "',`v`.`Titolo`,'/') as link, `descrizione` as `description` FROM ((`vip`     `v` join `immagine` `i`) join `professori` `p`)  WHERE (`v`.`immagine` = `i`.`id`) and (`v`.`autore` = `p`.`id`) ORDER BY pubDate DESC LIMIT 0, " . $nvip;
$query = "(" . $ricette . ") UNION (" . $articoli . ") UNION (" . $vip . ") ORDER BY pubDate DESC";
$data = DB_Manager::getInstance()->query($query);
$myRss->setFeeds($data);
$myRss->save(getcwd());
$meta['title'] = 'Ricette di Master di Cucina';
$meta['description'] = 'Ricette dei maestri di Master di Cucina';
$meta['type'] = '_ricette';
$myRss=new Rss_Manager('rss.xml', $meta);
$nric = 10;
$ricette = "SELECT `r`.`Titolo` AS `title`,concat(`p`.`nome`,' ',`p`.`cognome`) AS `author`,`i`.`uri` as `uri`,`Data` as `pubDate`, CONCAT('" . Config::$site_name . '/ricetta/' . "',`r`.`Titolo`,'/') as link, `descrizione` as `description` FROM ((`ricette` `r` join `immagine` `i`) join `professori` `p`)  WHERE (`r`.`immagine` = `i`.`id`) and (`r`.`autore` = `p`.`id`) ORDER BY pubDate DESC LIMIT 0, ". $nric;
$data = DB_Manager::getInstance()->query($ricette);
$myRss->setFeeds($data);
$myRss->saveType(getcwd(),'ricette');
$meta['title'] = 'Vini di Scuola di Cucina';
$meta['description'] = 'Vini commentati dai maestri di Master di Cucina';
$meta['type'] = '_vini';
$myRss=new Rss_Manager('rss.xml', $meta);
$nvin = 10;
$vini = "SELECT `v`.`Titolo` AS `title`,concat(`p`.`nome`,' ',`p`.`cognome`) AS `author`,`i`.`uri` as `uri`,`Data` as `pubDate`, CONCAT('" . Config::$site_name . '/vino/' . "',`v`.`Titolo`,'/') as link, `descrizione` as `description` FROM ((`vini` `v` join `immagine` `i`) join `professori` `p`)  WHERE (`v`.`immagine` = `i`.`id`) and (`v`.`autore` = `p`.`id`) ORDER BY pubDate DESC LIMIT 0, ". $nvin;
$data = DB_Manager::getInstance()->query($vini);
$myRss->setFeeds($data);
$myRss->saveType(getcwd(),'vini');
$meta['title'] = 'Articoli di Master di Cucina';
$meta['description'] = 'Articoli sul mondo della Cucina';
$meta['type'] = '_articoli';
$myRss=new Rss_Manager('rss.xml', $meta);
$nart = 10;
$articoli = "SELECT `n`.`Titolo` AS `title`,concat(`p`.`nome`,' ',`p`.`cognome`) AS `author`,`i`.`uri` as `uri`,`Data` as `pubDate`, CONCAT('" . Config::$site_name . '/articolo/' . "',`n`.`Titolo`,'/') as link, `descrizione` as `description` FROM ((`notizie` `n` join `immagine` `i`) join `professori` `p`)  WHERE (`n`.`immagine` = `i`.`id`) and (`n`.`autore` = `p`.`id`) ORDER BY pubDate DESC LIMIT 0, " . $nart;
$data = DB_Manager::getInstance()->query($articoli);
$myRss->setFeeds($data);
$myRss->saveType(getcwd(),'articoli');
$meta['title'] = 'Vip di Master di Cucina';
$meta['description'] = 'Notizie sui Vip a cura dei maestri di Master di Cucina';
$meta['type'] = '_vip';
$myRss=new Rss_Manager('rss.xml', $meta);
$nvip = 10;
$vip = "SELECT `v`.`Titolo` AS `title`,concat(`p`.`nome`,' ',`p`.`cognome`) AS `author`,`i`.`uri` as `uri`,`Data` as `pubDate`, CONCAT('" . Config::$site_name . '/vip/' . "',`v`.`Titolo`,'/') as link, `descrizione` as `description` FROM ((`vip`     `v` join `immagine` `i`) join `professori` `p`)  WHERE (`v`.`immagine` = `i`.`id`) and (`v`.`autore` = `p`.`id`) ORDER BY pubDate DESC LIMIT 0, " . $nvip;
$data = DB_Manager::getInstance()->query($vip);
$myRss->setFeeds($data);
$myRss->saveType(getcwd(),'vip');

?>
